local old_cook_fn = ACTIONS.COOK.fn
ACTIONS.COOK.fn = function(act)
    if act.doer and act.target and act.target.components.cooker then
        local stacksize = act.invobject and act.invobject.components.stackable and act.invobject.components.stackable:StackSize() or 1
        local cook_pos = act.target:GetPosition()
        local cooknum = 0
        for i = 1, stacksize do
            if act.target and act.target:IsValid() then
                local ingredient = act.doer.components.inventory:RemoveItem(act.invobject)
                ingredient.Transform:SetPosition(cook_pos:Get())

                if not act.target.components.cooker:CanCook(ingredient, act.doer) then
                    act.doer.components.inventory:GiveItem(ingredient, nil, cook_pos)
                end

                if ingredient.components.health ~= nil and ingredient.components.combat ~= nil then
                    act.doer:PushEvent("killed", { victim = ingredient })
                end

                local product = act.target.components.cooker:CookItem(ingredient, act.doer)
                if product ~= nil then
                    act.doer.components.inventory:GiveItem(product, nil, cook_pos)
                    cooknum = cooknum + 1
                elseif ingredient:IsValid() then
                    act.doer.components.inventory:GiveItem(ingredient, nil, cook_pos)
                end
            end
        end
        return cooknum > 0
    end
    return old_cook_fn(act)
end
-----------------整组烹饪-----------------